<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class register extends CI_Controller {
	private $massage='';
   
    public function __construct()
    {
        parent::__construct();
		$this->load->model('register_model','register');
    }
  
    public function index(){
		$this->smarty->display('register.tpl');
    }
	
	public function action()
	{
		if(!empty($_POST['bt_submit']))
		{
			$this->form_validation->set_rules('FullName','Họ Tên','trim|required','max|length[150]');
			$this->form_validation->set_rules('Passwd','Mật Khẩu','trim|required','max|length[32]');
			$this->form_validation->set_rules('Gender','Giới tính','trim|required');
			$this->form_validation->set_rules('Email','Email','trim|required','max|length[50]');
			if($this->form_validation->run()==FALSE){
				$this->massage=validation_errors();
			}else{
				if($this->register->save()){
					redirect('register/success');
				}
			}
		}
	}
	
	public function success()
	{
		echo "thành công roi";
	}
	
	public function get_form()
	{
		$data['FullName']=$this->input->post('FullName');
		$data['Passwd']=$this->input->post('Passwd');
		$data['Email']=$this->input->post('Email');
		$data['Address']=$this->input->post('FullName');
		$data['Birthday']=$this->input->post('FullName');
		$data['PhoneNumber']=$this->input->post('FullName');
		$data['Bongda']=$this->input->post('FullName');
		$data['Xemphim']=$this->input->post('FullName');
		$data['Boiloi']=$this->input->post('FullName');
		$data['Nghenhac']=$this->input->post('FullName');
		$data['IsActive']=$this->input->post('FullName');
		return $data;
	}
}